using System;
using System.Data;
using System.Globalization;
using System.Text;
using System.Xml;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;
using System.Collections.Generic;
using System.Text;
using Entity;

namespace Data
{
	/// <summary>
	/// Shabane
	/// </summary>
   public class PartySQL
    {

        public Party GetParty(int id)
        {
            
            //string spName = "spPartyGet";

            return null;
        }

       public void DataTableToParty(System.Data.DataTable dataTable, Party party)
       {

       }

       public void PartyToDataTable(System.Data.DataTable dataTable, Party party)
       {
           if (dataTable.Rows.Count > 0)
           {
               party.ID = (int)dataTable.Rows[0]["PartyID"];
               party.Username = (string)dataTable.Rows[0]["Username"];
               party.Password = (string)dataTable.Rows[0]["Password"];
           }
       }


       public Party GetParty(string username, string password)
       {
           Party party = new Party();
           string spName = "spPartyGetLogin";
           //DbCommand dbCommand = DatabaseHelper.DB.GetStoredProcCommand(spName);
           //this.DataTableToParty(DatabaseHelper.DB.ExecuteDataSet(dbCommand).Tables[0], party);
           return party;
       }


       protected void Load(Party party, int id)
       {
           party = GetParty(id);
       }

        public Party InsertParty(Party p)
        {
            string spName = "spPartyInsert";
            return null;
        }

        public Party UpdateParty(Party p)
        {
            string spName = "spPartyUpdate";
            return null;
        }

        public void DeleteParty(int id)
        {
            string spName = "spPartyDelete";
        }


       public DataSet GetPartyList()
       {
           DataSet dsPerson;
           //DbCommand dbCommand = DatabaseHelper.DB.GetSqlStringCommand("Select * From Party pty join Person prs on pty.PartyID = prs.PartyID");
           
           //dsPerson = DatabaseHelper.DB.ExecuteDataSet(dbCommand);
           //dsPerson.Tables[0].TableName = "Person";

           return new DataSet();
       }

    }
}
